package com.alex.controller.test;

import com.alex.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class JSONController {

    @Resource
    private UserService userService;

    @RequestMapping("/test/json")
    public String test() {
        return "test/json";
    }

    @ResponseBody
    @RequestMapping("/test/json/api/01")
    public Object test01() {
        return userService.getAll();
    }

    @ResponseBody
    @RequestMapping("/test/json/api/02")
    public Object test02() {
        return userService.getById(1);
    }
}
